<!-- 基础表格配置 -->
<template>
    <div>
        <el-form-item label="单位">
            <avue-input v-model="main.activeOption.unit" :disabled="disabled">
            </avue-input>
        </el-form-item>
        <el-form-item label="行数">
            <avue-input-number
                v-model="main.activeOption.showCount"
                :min="0"
                :disabled="disabled"
            >
            </avue-input-number>
        </el-form-item>
        <el-form-item label="整页轮播">
            <avue-switch
                v-model="main.activeOption.carousel"
                :disabled="disabled"
            ></avue-switch>
        </el-form-item>
        <el-form-item label="时间间隔(秒)">
            <avue-input-number
                v-model="main.activeOption.waitTime"
                :disabled="disabled"
            >
            </avue-input-number>
        </el-form-item>
        <el-collapse accordion> </el-collapse>
        <codeedit
            @submit="codeClose"
            v-model="code.obj"
            v-if="code.box"
            :type="code.type"
            :visible.sync="code.box"
        ></codeedit>
    </div>
</template>

<script>
import {
    scrollTableOption,
    dicOption,
    scrollTableAlarmOption
} from "@/option/config";
import codeedit from "../../page/group/code";
export default {
    name: "scrollRankingBoard",
    data() {
        return {
            disabled: this.contain.activeObj.isLock,
            dicOption: dicOption,
            scrollTableOption: scrollTableOption,
            scrollTableAlarmOption: scrollTableAlarmOption,
            code: {
                box: false,
                type: "data",
                obj: {}
            }
        };
    },
    inject: ["main", "contain"],
    components: {
        codeedit
    },
    methods: {
        rowSave(row, done) {
            this.main.activeOption.column.push(this.deepClone(row));
            done();
        },
        rowDel(row, index) {
            this.main.activeOption.column.splice(index, 1);
        },
        rowUpdate(row, index, done) {
            this.main.activeOption.column.splice(index, 1, this.deepClone(row));
            done();
        },
        rowSaveAlarm(row, done) {
            this.main.activeOption.alarmConfig.push(this.deepClone(row));
            done();
        },
        rowDelAlarm(row, index) {
            this.main.activeOption.alarmConfig.splice(index, 1);
        },
        rowUpdateAlarm(row, index, done) {
            this.main.activeOption.alarmConfig.splice(
                index,
                1,
                this.deepClone(row)
            );
            done();
        },
        codeClose(value) {
            console.log("this.code ", this.code);
            this.main.activeOption.column = value;
        },
        openCode() {
            this.code.obj = this.main.activeOption.column;
            this.code.box = true;
        }
    }
};
</script>

<style></style>
